//
//  ViewController.m
//  Group
//
//  Created by YYY on 2017/12/8.
//  Copyright © 2017年 成品家（北京）网路科技有限公司. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    //创建调度组
    dispatch_group_t group = dispatch_group_create();
    
    //创建队列
    dispatch_group_t queue = dispatch_get_global_queue(0, 0);
    
    //入组
    dispatch_group_enter(group);
    dispatch_async(queue, ^{
        NSLog(@"download A %@",[NSThread currentThread]);
        //出组
        dispatch_group_leave(group);
    });
    
    //入组
    dispatch_group_enter(group);
    dispatch_async(queue, ^{
        NSLog(@"download B %@",[NSThread currentThread]);
        //出组
        dispatch_group_leave(group);
    });
    
    dispatch_group_notify(group, dispatch_get_main_queue(), ^{
        NSLog(@"come here %@",[NSThread currentThread]);
    });
}


@end
